#define _CRT_SECURE_NO_WARNINGS
#include <iostream>

using namespace std;

const int N = 4e4 + 10;
int n;
int phi[N];
int p[N], cnt;
bool st[N];
void get_phi()
{
	phi[1] = 1;
	for (int i = 2; i <= n; i++)
	{
		if (!st[i])
		{
			p[++cnt] = i;
			phi[i] = i - 1;
		}
		for (int j = 1; i * p[j] <= n; j++)
		{
			int x = i * p[j];
			st[x] = true;
			if (i % p[j] == 0)
			{
				phi[x] = p[j] * phi[i];
				break;
			}
			else
			{
				phi[x] = (p[j] - 1) * phi[i];
			}
		}
	}
}
int main()
{
	cin >> n;
	get_phi();
	int sum = 0;
	for (int i = 1; i < n; i++)
	{
		sum += phi[i];
	}
	if (n == 1) cout << 0 << endl;
	else cout << sum * 2 + 1 << endl;
	return 0;
}